//
//  BaseTabBarViewController.m
//  CwinCar
//
//  Created by dlios on 15/10/16.
//  Copyright © 2015年 dlios. All rights reserved.
//

#import "BaseTabBarViewController.h"

#import "BaseHeader.h"
@interface BaseTabBarViewController ()

@end

@implementation BaseTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //1.初始化子控制器
    
    
    CCFirstPageViewController *firstPageVC = [[CCFirstPageViewController alloc]init];
//    [self addChildVC:firstPageVC title:@"首页" image:@"iconfont-shouye-3"];
    UINavigationController *firstNav = [[UINavigationController alloc]initWithRootViewController:firstPageVC];
    firstNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"首页" image:[UIImage imageNamed:@"iconfont-shouyeshouye-3"] selectedImage:[UIImage imageNamed:@"iconfont-shouyeshouye-2"]];
    
    CCFormViewController *formVC = [[CCFormViewController alloc]init];
    UINavigationController *formNav = [[UINavigationController alloc]initWithRootViewController:formVC];
    formNav.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"论坛" image:[UIImage imageNamed:@"iconfont-luntan-1"] selectedImage:[UIImage imageNamed:@"iconfont-luntan"]];
//    [self addChildVC:formVC title:@"论坛" image:@"iconfont-luntan-3"];
//
//    
    CCFinderViewController *findCarVC = [[CCFinderViewController alloc]init];
    UINavigationController *findCarNac = [[UINavigationController alloc]initWithRootViewController:findCarVC];
   findCarNac.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"找车" image:[UIImage imageNamed:@"iconfont-che-1"] selectedImage:[UIImage imageNamed:@"iconfont-che"]];
//    [self addChildVC:findCarVC title:@"找车" image:@"iconfont-chazhao-3"];
//
    CCDiscoverViewController *discoverVC = [[CCDiscoverViewController alloc]init];
    UINavigationController *discoverNac = [[UINavigationController alloc]initWithRootViewController:discoverVC];
   discoverNac.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"发现" image:[UIImage imageNamed:@"iconfont-faxian-1"] selectedImage:[UIImage imageNamed:@"iconfont-faxian"]];
//    [self addChildVC:discoverVC title:@"发现" image:@"iconfont-faxian-3"];
//
    CCMineViewController *mineVC = [[CCMineViewController alloc]init];
    
//    [self addChildVC:mineVC title:@"我的" image:@"iconfont-wode-2"];
    UINavigationController *mineNac  = [[UINavigationController alloc]initWithRootViewController:mineVC];
  mineNac.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"我的" image:[UIImage imageNamed:@"iconfont-bf-user-1"] selectedImage:[UIImage imageNamed:@"iconfont-bf-user"]];
    self.viewControllers = @[firstNav,formNav,findCarNac,discoverNac,mineNac];


    // Do any additional setup after loading the view.
}
- (void)addChildVC:(UIViewController *)childVC title:(NSString *)title image:(NSString *)image
{
//    CCDiscoverViewController *discoverVC = [[CCDiscoverViewController alloc]init];
//    UINavigationController *discoverNac = [[UINavigationController alloc]initWithRootViewController:discoverVC];
//    UIImage *discoverImge = [UIImage imageNamed:@"iconfont-faxian-3"];
//    discoverNac.tabBarItem = [[UITabBarItem alloc]initWithTitle:@"发现" image:discoverImge tag:1003];
    //设置tabbar的标题 和 图片
//    childVC.title = title;
    childVC.tabBarItem.title = title;
    childVC.tabBarItem.image = [[UIImage imageNamed:image]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    childVC.view.backgroundColor =[UIColor colorWithRed:0.088 green:0.331 blue:1.000 alpha:1.000];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:childVC];
    [self addChildViewController:nav];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
